#ifndef	____CAR_CONTROL_PI_H_____
#define	____CAR_CONTROL_PI_H_____
#include "../config.h"
#include "../message/ctl_hand_msg.h"
typedef struct car_wheel_cfg_{
        int  lw_gpioA;
		int  lw_gpioB;
        int  rw_gpioA;       
        int  rw_gpioB;
        int  lw_can;
        int  rw_can;
		int  max_speed;
		int  lw_speed;		
		int  rw_speed;		
}car_wheel_cfg;

typedef struct car_hand_cfg_{
		//串口配置
        char* dev;
		int fd;	//串口句柄
		int nSpeed;//波特率 115200
		int nBits;//传输倍数	8
		char nEvent;//奇偶校验 'N'
		int nStop;//停止位	1

		//机械手编号配置
		int motor_code[7];
		int default_speed;	//默认舵机转动速度 每秒转动的角度（500-2500）
}car_hand_cfg;

typedef struct robot_car_pi_ {
	car_wheel_cfg * wheel;
	car_hand_cfg * hand;
} robot_car_pi;


int car_init(robot_car_pi* cfg);

int car_move_on(robot_car_pi* cfg);

int car_stop(robot_car_pi* cfg);

int car_back_up(robot_car_pi* cfg);

int car_turn_left(robot_car_pi* cfg);

int car_turn_right(robot_car_pi* cfg);

int car_speed_change(robot_car_pi* cfg);


//多个舵机动作接口
int car_ctl_motions(car_hand_cfg* cfg,motion_data * motions,int motion_size);

//执行动作动
int car_ctl_motion_group(car_hand_cfg* cfg,motion_group_data * motion_group);

int car_uninit(robot_car_pi* cfg);



#endif
